const http = require('http');
const url = require('url');
 
// 创建 HTTP 服务器
const server = http.createServer((req, res) => {
    if (req.method === 'GET') {
        // 解析查询字符串
        const queryObject = url.parse(req.url, true).query;
 
        res.writeHead(200, { 'Content-Type': 'application/json' });
        res.end(JSON.stringify({ message: 'Hello', query: queryObject }));
    }
});
 
// 启动服务器
server.listen(3000, () => {
    console.log('Server is running on http://127.0.0.1:3000');
});